#ifndef SLOG2_COMMON_H_
#define SLOG2_COMMON_H_
#include <cstdint>
#include<type_traits>
/**
 * @brief Verbosity levels, in decreasing order of Verbosity.
 *
 * Maps one-by-one to the values from the verbosity_level of slog2.
 * @sa <sys/slog2.h>
 */
enum class Slog2VerbosityLevel : std::uint8_t
{
    kShutdown = 0x00,  ///< shut down the system now
    kCritical = 0x01,  ///<  unexpected unrecoverable error
    kError = 0x02,  ///< unexpected recoverable error
    kWarning = 0x03,  ///< expected error
    kNotice = 0x04,   ///< warning
    kInfo = 0x05,  ///< Informational
    kDebug1 = 0x06,  ///< debug messages (e.g., normal detail).
    kDebug2 = 0x07  ///< debug messages (e.g., fine detail).
};

using Slog2SeverityLevel = Slog2VerbosityLevel;


/**
 * @brief Slog2Return. Flags to define return values.
 */
enum class Slog2ReturnValue : std::int8_t
{
    kReturnLoggingDisabled = -7,
 //   kReturnUserBufferFull = -6,
    kReturnWrongParameter = -5,
    kReturnBufferFull = -4,
//    kReturnPipeFull = -3,
//    kReturnPipeError = -2,
    kReturnError = -1,
    kReturnOk = 0,
    kReturnTrue = 1
};

template <typename EnumT>
constexpr auto to_integral(const EnumT value) noexcept
{
    return static_cast<std::underlying_type_t<EnumT>>(value);
}

#endif // SLOG2_COMMON_H_
